package com.itheima.controller;

import com.itheima.domain.Account;
import com.itheima.service.AccountService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class AccountController {
    private Logger logger= LoggerFactory.getLogger(AccountController.class);
    @Autowired

    private AccountService accountService;

    public void transfer(int from,int to,double money){
        //权限校验 是否登录没有.....
        //参数校验

        //记录日志
        logger.info("正在接受用户请求...做转账业务...转入人:{},转出人{},转出金额{}",to,from,money);

        accountService.transfer(from,to,money);
    }

    public void delete(int id){

        accountService.delete(id);
    }
    public void add(Account account){

        accountService.add(account);
    }

    public Account findById(int id){
        return accountService.findById(id);
    }



}
